# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=fluidsynth

pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=1.1.6
pkgrel=1
pkgdesc="A real-time software synthesizer based on the SoundFont 2 specifications (mingw-w64)"
arch=('any')
url="http://www.fluidsynth.org/"
license=('LGPL')
depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs"
        "${MINGW_PACKAGE_PREFIX}-glib2"
        "${MINGW_PACKAGE_PREFIX}-libsndfile"
        "${MINGW_PACKAGE_PREFIX}-portaudio"
        
        )
makedepends=("nasm" "${MINGW_PACKAGE_PREFIX}-gcc")
options=('strip' 'staticlibs')
source=("http://downloads.sourceforge.net/${_realname}/${_realname}-$pkgver.tar.gz"
        0001-10-ftbfs-bug-690006.all.patch
        0002-1001-revert_abi_break_114.all.patch
        0003-include-blddir.all.patch
        0004-disable-rtkit-bindings-on-w32.all.patch)
md5sums=('ae5aca6de824b4173667cbd3a310b263'
         'bf190e67a925319323c06d17cd45d760'
         'cb4079dbc95504b14ef82cd31fb9fe5e'
         '617dbfec395b2eaa423fd5f32459905a'
         '18f50014be62facdd4b10f305b886e88')

prepare() {
  cd "$srcdir/${_realname}-${pkgver}"
  patch -p1 -i ${srcdir}/0001-10-ftbfs-bug-690006.all.patch
  patch -p1 -i ${srcdir}/0002-1001-revert_abi_break_114.all.patch
  patch -p1 -i ${srcdir}/0003-include-blddir.all.patch
  patch -p1 -i ${srcdir}/0004-disable-rtkit-bindings-on-w32.all.patch
  
  ./autogen.sh
}

build() {
  cd "$srcdir/${_realname}-${pkgver}"

  export lt_cv_deplibs_check_method='pass_all'
  ./configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST} \
    --without-readline \
    STRIP=true CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" LDFLAGS="$LDFLAGS" PTHREAD_LIBS=-lpthread
  make
}

package() {
  cd "$srcdir/${_realname}-${pkgver}"
  make DESTDIR="$pkgdir" install
}
